/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mycompany.mavenproject1;

/**
 *
 * @author dell
 */
public class Calculator {
    private double value;
    public void AC(){
        value = 0;
    }
    public void Add(double number){
//</editor-fold>
        value += number;
    }
    public void Subtract(double number){
        System.out.println("num:"+number +"value:"+value);
        if(value==0){
             value = number;
        }else{
             value -= number;
        }
    }
    
    public void Divide(double number){
        
        try{
           
           
            value = value/number;
        }catch(Exception e){
            
        }
    }
    public void Multiply(double number){
        value *= number;
    }
    public double getValue(){
        return value;
    }
    public static void main(String[] args){
        Calculator calculator = new Calculator();
        calculator.Add(10);
        calculator.Subtract(1);
        calculator.Multiply(2);
        calculator.Divide(2);
        System.out.println(calculator.getValue());
        calculator.AC();
        System.out.println(calculator.getValue());
    }
    
    
}


